from pydantic import BaseModel
from datetime import datetime
from typing import Optional


class ChatMessageRequest(BaseModel):
    content: str
    chat_room_id: int


class ChatMessageResponse(BaseModel):
    id: int
    content: str
    sender_type: str
    created_at: datetime
    chat_room_id: int
    
    class Config:
        orm_mode = True


class ChatRoomBase(BaseModel):
    name: str
    description: Optional[str] = None


class ChatRoomResponse(ChatRoomBase):
    id: int
    created_at: datetime
    member_count: Optional[int] = None
    
    class Config:
        orm_mode = True